package com.cloud.tsp.controller;

import com.cloud.api.domain.stats.MaintenanceRes;
import com.cloud.api.domain.stats.QueryMaintenance;
import com.cloud.api.domain.stats.RepairStation;
import com.cloud.api.validgroup.ValidateGroupSelectVin;
import com.cloud.log.annotation.Log;
import com.cloud.log.enums.BusinessType;
import com.cloud.log.enums.OperatorType;
import com.cloud.mybatis.domain.TableDataInfo;
import com.cloud.tsp.service.IMaintenanceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author haohaibo
 * @since 2025-01-15
 */
@RestController
@RequestMapping("/maintenance")
public class MaintenanceController {

    @Resource
    private IMaintenanceService maintenanceService;

    @Tag(name = "v1.0")
    @Operation(summary = "查询维修站车辆列表（管理）")
    @PostMapping("/getMaintenanceCarList")
    @Log(title = "维修站车辆-查询维修站车辆列表", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public TableDataInfo<MaintenanceRes> selectMaintenanceCarList(@RequestBody @Validated(ValidateGroupSelectVin.class) QueryMaintenance para){
        return maintenanceService.selectMaintenanceCarList(para);
    }

    @Tag(name = "v1.0")
    @Operation(summary = "查询维修站列表（管理）")
    @PostMapping("/getMaintenanceList")
    @Log(title = "维修站车辆-查询维修站列表", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public TableDataInfo<RepairStation> selectMaintenanceList(@RequestBody @Valid QueryMaintenance para){
        return maintenanceService.selectMaintenanceList(para);
    }

}